package com.wbc.demo.CompletableFutureDemo;

/**
 * @author 389561407@qq.com
 * @version 1.0
 * @since 2022-11-30
 */
public class HttpRequestMock {

    public static double getMouBaoPrice(String product) {
        sleep();
        System.out.println("获取淘宝价格："+800);
        return 800;
    }


    public static double getMouBaoDiscounts(String product) {
        sleep();
        System.out.println("获取到淘宝折扣："+0.8);
        return 0.8;
    }

    public static double getMouDongPrice(String product) {
        sleep();
        System.out.println("获取京东价格："+900);
        return 900;
    }

    public static double getMouXiXiPrice(String product) {
        sleep();
        System.out.println("获取多多价格："+18);
        return 18;
    }

    public static double getMouDongDiscounts(String product) {
        sleep();
        System.out.println("获取到京东折扣："+0.5);
        return 0.5;
    }

    public static double getMouXiXiDiscounts(String product) {
        sleep();
        System.out.println("获取到多多折扣："+0.6);
        return 0.6;
    }

    private static void sleep() {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
